<template>
  <keep-alive>
  
     <a-config-provider :locale="locale">
    <div id="app">
      <div>
          <a-button  @click="changeLocale('en-us')" v-show="localeval=='zh-cn'">English</a-button>
           <a-button  @click="changeLocale('zh-cn')" v-show="localeval=='en-us'">中文</a-button>
        <!-- <button @click="changeLocale('en-us')" v-show="localeval=='zh-cn'">English</button > -->
        <!-- <button @click="changeLocale('zh-cn')" v-show="localeval=='en-us'">中文</button > -->
      </div>
    <!-- <router-view/> -->
     <router-view  v-wechat-title='$route.meta.title'/>
    </div>
  </a-config-provider>
  </keep-alive>
</template>

<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import moment from 'moment'
import 'moment/locale/zh-cn'
moment.locale('zh-cn')
const EN = 'en-us'
const ZH = 'zh-cn'
export default {
  name: 'App',
  provide(){
      return {
      app:this.zh
      }
  },
  data () {
    return {
      zh:9999,
      locale: zhCN,
      localeval: 'zh-cn'
    }
  },
  methods: {
    moment,
    changeLocale (localeval) {
      this.localeval = localeval
      if (localeval === EN) {
        moment.locale(EN)
        this.$i18n.locale = EN
        this.locale = null
      } else {
        moment.locale(ZH)
        this.$i18n.locale = ZH
        this.locale = zhCN
      }
    }
  }
}
</script>
